package com.bwie.utils;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;

/**
 * @Author: badaotianqiong
 * @Date: 2025/6/20 14:10
 * @Description:
 **/
public class TokenUtils {

    public static Integer getUserId(String token){
        Claims body = Jwts.parser().setSigningKey("123456").parseClaimsJws(token).getBody();
        Integer userId = body.get("userId", Integer.class);
        return userId;
    }

    public static String getUserName(String token){
        Claims body = Jwts.parser().setSigningKey("123456").parseClaimsJws(token).getBody();
        String userName = body.get("userName", String.class);
        return userName;
    }
}
